<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\WechatUser;
use Carbon\Carbon;

class WechatUserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $users = [
            [
                'openid' => 'o6_bmjrPTlm6_2sgVt7hMZOPfL2M',
                'unionid' => 'o6_bmasdasdsad6_2sgVt7hMZOPfL2M',
                'nickname' => '张三',
                'avatar' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLL1byctY955FrMQueH2FgKwsAeU1fzlNi81r3aVx2ADqQVxhn9Ov0x0NND5G3VZtrbdHu6qtEnrg/132',
                'gender' => WechatUser::GENDER_MALE,
                'country' => '中国',
                'province' => '广东',
                'city' => '深圳',
                'language' => 'zh_CN',
                'phone' => '13800138001',
                'email' => 'zhangsan@example.com',
                'subscribe_time' => Carbon::now()->subDays(30),
                'subscribe_status' => WechatUser::SUBSCRIBE_STATUS_SUBSCRIBED,
                'remark' => 'VIP用户',
                'privileges' => ['chinaunicom'],
            ],
            [
                'openid' => 'o6_bmjrPTlm6_2sgVt7hMZOPfL3N',
                'unionid' => 'o6_bmasdasdsad6_2sgVt7hMZOPfL3N',
                'nickname' => '李四',
                'avatar' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eoj0hHXhgJNOTSOFsS4uZs8x1ConecaVOB8eIl115xmJZcT4oCicvia7wMEufibKtTLqmXSoXBZjcLRw/132',
                'gender' => WechatUser::GENDER_FEMALE,
                'country' => '中国',
                'province' => '北京',
                'city' => '北京',
                'language' => 'zh_CN',
                'phone' => '13800138002',
                'email' => 'lisi@example.com',
                'subscribe_time' => Carbon::now()->subDays(15),
                'subscribe_status' => WechatUser::SUBSCRIBE_STATUS_SUBSCRIBED,
                'remark' => '普通用户',
                'privileges' => [],
            ],
            [
                'openid' => 'o6_bmjrPTlm6_2sgVt7hMZOPfL4O',
                'unionid' => null,
                'nickname' => '王五',
                'avatar' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4uBdAVkmqTvpFXQrEQh2TaS0vQxiafwHwsHN0UwVmRjXNPiLdlpaWicOrQBrjXh5p6hOkMnicdUuGw/132',
                'gender' => WechatUser::GENDER_MALE,
                'country' => '中国',
                'province' => '上海',
                'city' => '上海',
                'language' => 'zh_CN',
                'phone' => '13800138003',
                'email' => 'wangwu@example.com',
                'subscribe_time' => Carbon::now()->subDays(7),
                'subscribe_status' => WechatUser::SUBSCRIBE_STATUS_SUBSCRIBED,
                'remark' => '新用户',
                'privileges' => ['voice', 'video'],
            ],
            [
                'openid' => 'o6_bmjrPTlm6_2sgVt7hMZOPfL5P',
                'unionid' => 'o6_bmasdasdsad6_2sgVt7hMZOPfL5P',
                'nickname' => '赵六',
                'avatar' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/ajNVdqHZLLA3WJ6DSZUfiakYe37PKnQhBIeOQBO4czqrnZDS79FH5Wm5m4X69TBicnHFlhiafvDwklOpZeXYQQ2yg/132',
                'gender' => WechatUser::GENDER_UNKNOWN,
                'country' => '中国',
                'province' => '江苏',
                'city' => '南京',
                'language' => 'zh_CN',
                'phone' => null,
                'email' => null,
                'subscribe_time' => Carbon::now()->subDays(3),
                'unsubscribe_time' => Carbon::now()->subDay(),
                'subscribe_status' => WechatUser::SUBSCRIBE_STATUS_UNSUBSCRIBED,
                'remark' => '已取消关注',
                'privileges' => [],
            ],
            [
                'openid' => 'o6_bmjrPTlm6_2sgVt7hMZOPfL6Q',
                'unionid' => 'o6_bmasdasdsad6_2sgVt7hMZOPfL6Q',
                'nickname' => '孙七',
                'avatar' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLL1byctY955FrMQueH2FgKwsAeU1fzlNi81r3aVx2ADqQVxhn9Ov0x0NND5G3VZtrbdHu6qtEnrg/132',
                'gender' => WechatUser::GENDER_FEMALE,
                'country' => '中国',
                'province' => '浙江',
                'city' => '杭州',
                'language' => 'zh_CN',
                'phone' => '13800138005',
                'email' => 'sunqi@example.com',
                'subscribe_time' => Carbon::now()->subHours(12),
                'subscribe_status' => WechatUser::SUBSCRIBE_STATUS_SUBSCRIBED,
                'remark' => '活跃用户',
                'privileges' => ['shake_around', 'location'],
            ],
        ];

        foreach ($users as $userData) {
            WechatUser::create($userData);
        }

        $this->command->info('微信用户测试数据创建完成！');
    }
}